<?php

namespace app\common\model;

use think\Model;

class Admin extends Model
{
    public function login($data)
    {
        $validate = new \app\common\validate\Admin();
        if (!$validate->scene('login')->check($data)) {
            return $validate->getError();
        }
        unset($data['verify']);
        $result = $this->where($data)->find();
        if ($result) {
            session('adminuser', $data['username']);
            return 1;
        }else {
            return '用户名或者密码错误！';
        }
    }
}
